#coding=utf-8
from numpy import *
from mlCource import kMeans

path ="D:\Project\P_Pycharm\ldwuPythonHome\data"
fileName = path + "\\testSet.txt"

def t_01():
    dataMat=mat(kMeans.loadDataSet(fileName))
    print dataMat[0:2]
    # print kMeans.randCent(dataMat,2)
    # centroids = kMeans.randCent(dataMat,3)  #获取3个随机数
    # print centroids
    print kMeans.distEclud(dataMat[0],dataMat[1])  #计算2个向量距离
    myCentroids,clustAssing = kMeans.kMeans(dataMat, 3)[0:2]
    print clustAssing

if __name__ == '__main__':
    t_01()